import request from '@/utils/request'

// 分页查询
export const GetCourseListByPage = (pageNum, pageSize, queryDto) => {
    return request({
        url: '/admin/educational/course/findByPage/' + pageNum + '/' + pageSize,
        method: 'get',
        params: queryDto,
    })
}

// 新增学生的方法
export const SaveCourse = data => {
    return request({
        url: '/admin/educational/course/saveCourse',
        method: 'post',
        data: data,
    })
}

// 修改学生数据的方法
export const UpdateCourse = course => {
    return request({
        url: '/admin/educational/course/updateCourse',
        method: 'put',
        data: course,
    })
}

export const DeleteCourseById = courseId => {
    return request({
        url: '/admin/educational/course/deleteById/' + courseId,
        method: 'delete',
    })
}

export const FindAllCourse = () => {
    return request({
        url: '/admin/educational/course/findAllCourse',
        method: 'get'
    })
}

export const GetCourseById = courseIdList => {
    const params = courseIdList.join(',');
    return request({
        url: '/admin/educational/course/getCourseById',
        method: 'get',
        params: {
            courseIdList: params
        }
    })
}


export const FindAllGradeComponents = () => {
    return request({
        url: '/admin/educational/course/findAllGradeComponents',
        method: 'get'
    })
}

export const GetGradeComponentIds = courseId => {
    return request({
        url: '/admin/educational/course/selectGradeComponentByCourseId/' + courseId,
        method: 'get'
    })
}

export const UpdateGradeComponentsWeight = gradeComponentDto => {
    return request({
        url: '/admin/educational/course/updateGradeComponentsWeight',
        method: 'put',
        data: gradeComponentDto
    })
}

export const FindAllCategory = () => {
    return request({
        url: '/admin/educational/course/findAllCategory',
        method: 'get'
    })
}
export const FindAllNature = () => {
    return request({
        url: '/admin/educational/course/findAllNature',
        method: 'get'
    })
}
export const FindAllOwnership = () => {
    return request({
        url: '/admin/educational/course/findAllOwnership',
        method: 'get'
    })
}

export const FetchLocalCoursesByCollegeId = (collegeId, category, nature) => {
    if (category === 'undefined') {
        category = null;
    }
    if (nature === 'undefined') {
        nature = null;
    }
    return request({
        url: '/admin/educational/course/fetchLocalCoursesByCollegeId/' + collegeId,
        method: 'get',
        params: {
            category: category,
            nature: nature
        }
    })
}

//查询班级课程
export const GetScheduleListByMajorIdAndClassesId = (classesId) => {
    return request({
        url: '/admin/educational/course/GetScheduleListByMajorIdAndClassesId/' + classesId,
        method: 'get',
    })
}

//查询个人课程
export const GetLessonPlanByStudentNumber = (studentNumber) => {
    return request({
        url: '/admin/educational/course/getScheduleListByStudentNumber/' + studentNumber,
        method: 'get',
    })
}

export const GetAllTeacherByCourseId = courseId => {
    return request({
        url: '/admin/educational/course/GetAllTeacherByCourseId/' + courseId,
        method: 'get',
    })
}

export const FindAllTeacherCourses = teacherCode => {
    return request({
        url: '/admin/educational/course/FindAllTeacherCoursesByTeacherCode/' + teacherCode,
        method: 'get',
    })
}


